import urllib.request
import urllib.parse
import string

def get_params():
    url = "http://www.baidu.com/s?"
    params = {
        "wd":"中文",
        "key":"zhang",
        "value":"san"
    }
    # 将冒号变成层号
    str_params = urllib.parse.urlencode(params)
    final_url = url + str_params;
    print(final_url)

    # 将带有中文的url转换成计算机可以识别的url
    end_url = urllib.parse.quote(final_url, safe=string.printable)
    print(end_url)
    response = urllib.request.urlopen(end_url)
    data = response.read().decode("utf-8");
    print(data)

# get_params()


